﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using TXLooker.Common.EventHandling;

namespace TXLooker.Common.Tests.EventHandling
{
    /// <summary>
    /// Summary description for EventSinkTests
    /// </summary>
    [TestClass]
    public class EventSinkTests
    {
        [TestMethod]
        public void Subscriber_receives_notification_about_subscribed_events()
        {
            // arrange
            bool called = false;
            const string eventName = "some.event";

            EventSink sink = new EventSink();
            sink.Subscribe(eventName, delegate() { called = true; });

            // act
            sink.Publish(eventName);

            // assert
            Assert.IsTrue(called, "Subscriber was not notified.");
        }
    }
}
